Board(int rows, int columns, int width, int height, String style, Color color)
- object constructor
private static Board board = new Board(3, 3, 500, 500, "Line", Color.LIGHT_GRAY);
shown in the above 3.
import.awt.*;
is required.void setTitle(String title)
- E.g., board.setTitle("3-Puzzle Game");
void cellsClickEventListener(BGPEventListener listener)
- register a 'click' event handler on all cells
board.cellsClickEventListener(new BGPEventListener() { @Override public void clicked(int row, int col) {
cellClicked(row, col); // A method in the user program
}}); // BGPEventListener in the trubgp library
Color cellBackgroundColor(int row, int col)
- return the background color of the cell pointed by row and colvoid cellBackgroundColor(int row, int col, Color color)
- set the background color of the cellString cellContent(int row, int col)
- return the cell contentvoid cellContent(int row, int col, String content)
- set cell content with the default font size void cellContent(int row, int col, String content, float font_size)
- set cell content with a specific font size void switchCells(int row0, int col0, int row1, int col1)
- switch all data stored/set in the two cellsvoid button1ClickEventListener(BGPEventListener listener
) - register an click event handler on the 1st buttonvoid button2ClickEventListener(BGPEventListener listener)
- register an click event handler on the 2nd buttonvoid button1SetName(String name)
void button2SetName(String name)
void showMessageDialog(String message)
- display a dialog popup windowString getText()
- read the string from the text fieldvoid setText(String s)
- write a string in the text fieldvoid clearText()
- clear the text areavoid appendText(String s)
- append a string at the end of the string in the text area